package com.yanqu.road.entity.config.musicroom;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;

import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_p_music_room_mission", desc = "妙音坊 关卡配置")
public class MusicRoomMissionConfig extends DataObject {
    @FieldTypeAnnotation(desc = "关卡id", select = true, isIndex = true)
    protected int id;
    @FieldTypeAnnotation(desc = "上阵人数")
    protected int battleNum;
    @FieldTypeAnnotation(desc = "推荐等级")
    protected int passLevel;
    @FieldTypeAnnotation(desc = "所需属性")
    protected String needAttributes = "";
    @FieldTypeAnnotation(desc = "通关奖励")
    protected String rewards = "";

    private Property needAttributeProperty = new Property();
    private List<List<Property>> rewardsPropertyList = new ArrayList<>();

    public MusicRoomMissionConfig(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getBattleNum() {
        return battleNum;
    }

    public void setBattleNum(int battleNum) {
        this.battleNum = battleNum;
    }

    public int getPassLevel() {
        return passLevel;
    }

    public void setPassLevel(int passLevel) {
        this.passLevel = passLevel;
    }

    public String getNeedAttributes() {
        return needAttributes;
    }

    public void setNeedAttributes(String needAttributes) {
//        this.needAttributes = needAttributes;
        this.needAttributeProperty = PropertyHelper.parseStringToProperty(needAttributes, "\\|");
    }

    public String getRewards() {
        return rewards;
    }

    public void setRewards(String rewards) {
//        this.rewards = rewards;
        this.rewardsPropertyList = PropertyHelper.parseNewStringToPropertyList(rewards);
    }

    public Property getNeedAttributeProperty() {
        return new Property(needAttributeProperty);
    }

    public List<List<Property>> getRewardsPropertyList() {
        return rewardsPropertyList;
    }
}
